package com.drinks.yiniang.adapter.community;

import android.content.Context;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseViewHolder;
import com.drinks.yiniang.R;
import com.drinks.yiniang.adapter.base.BaseQuickRCVAdapter;
import com.drinks.yiniang.entity.community.CommunityTopicJson;
import com.hansen.library.utils.StringUtils;

import java.util.List;

/**
 * 话题列表adapter
 * @author han
 * @date 2019/8/30
 */
public class TopicListAdapter extends BaseQuickRCVAdapter<CommunityTopicJson.TopicList, BaseViewHolder> {

    private StringBuilder mBuilder;

    public TopicListAdapter(Context mContext, @Nullable List<CommunityTopicJson.TopicList> data) {
        super(R.layout.item_topic_list, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, CommunityTopicJson.TopicList item) {
        mBuilder = new StringBuilder();
        mBuilder.append("#");
        mBuilder.append(StringUtils.getNoNullString(item.getName()));
        mBuilder.append("#");

        helper.setText(R.id.tv_topic_list_name, mBuilder);
    }
}
